/**
 * SearchInfoForm class.
 */
package pits.form;

import java.util.ArrayList;
import java.util.List;

import javax.portlet.ActionRequest;

public class SearchInfoForm {

	private String employeeName;
	private String companyID;
	private String departmentID;
	private String courseCom;
	private String courseDep;
	private String courseID;
	private String grade;
	private String projectCom;
	private String projectDep;
	private String projectID;
	private List<Integer> language;
	private List<Integer> langMOE;
	private List<Integer> application;
	private List<Integer> appMOE;
	private List<Integer> technology;
	private List<Integer> techMOE;
	private List<Integer> framework;
	private List<Integer> frameMOE;

	/**
	 * @return the employeeName
	 */
	public String getEmployeeName() {
		return employeeName;
	}

	/**
	 * @param employeeName
	 *            the employeeName to set
	 */
	public void setEmployeeName(String employeeName) {
		this.employeeName = employeeName;
	}

	/**
	 * @return the companyID
	 */
	public String getCompanyID() {
		return companyID;
	}

	/**
	 * @param companyID
	 *            the companyID to set
	 */
	public void setCompanyID(String companyID) {
		this.companyID = companyID;
	}

	/**
	 * @return the departmentID
	 */
	public String getDepartmentID() {
		return departmentID;
	}

	/**
	 * @param departmentID
	 *            the departmentID to set
	 */
	public void setDepartmentID(String departmentID) {
		this.departmentID = departmentID;
	}

	/**
	 * @return the courseCom
	 */
	public String getCourseCom() {
		return courseCom;
	}

	/**
	 * @param courseCom
	 *            the courseCom to set
	 */
	public void setCourseCom(String courseCom) {
		this.courseCom = courseCom;
	}

	/**
	 * @return the courseDep
	 */
	public String getCourseDep() {
		return courseDep;
	}

	/**
	 * @param courseDep
	 *            the courseDep to set
	 */
	public void setCourseDep(String courseDep) {
		this.courseDep = courseDep;
	}

	/**
	 * @return the courseID
	 */
	public String getCourseID() {
		return courseID;
	}

	/**
	 * @param courseID
	 *            the courseID to set
	 */
	public void setCourseID(String courseID) {
		this.courseID = courseID;
	}

	/**
	 * @return the grade
	 */
	public String getGrade() {
		return grade;
	}

	/**
	 * @param grade
	 *            the grade to set
	 */
	public void setGrade(String grade) {
		this.grade = grade;
	}

	/**
	 * @return the projectCom
	 */
	public String getProjectCom() {
		return projectCom;
	}

	/**
	 * @param projectCom
	 *            the projectCom to set
	 */
	public void setProjectCom(String projectCom) {
		this.projectCom = projectCom;
	}

	/**
	 * @return the projectDep
	 */
	public String getProjectDep() {
		return projectDep;
	}

	/**
	 * @param projectDep
	 *            the projectDep to set
	 */
	public void setProjectDep(String projectDep) {
		this.projectDep = projectDep;
	}

	/**
	 * @return the projectID
	 */
	public String getProjectID() {
		return projectID;
	}

	/**
	 * @param projectID
	 *            the projectID to set
	 */
	public void setProjectID(String projectID) {
		this.projectID = projectID;
	}

	/**
	 * @return the language
	 */
	public List<Integer> getLanguage() {
		return language;
	}

	/**
	 * @param language
	 *            the language to set
	 */
	public void setLanguage(List<Integer> language) {
		this.language = language;
	}

	/**
	 * @return the langMOE
	 */
	public List<Integer> getLangMOE() {
		return langMOE;
	}

	/**
	 * @param langMOE
	 *            the langMOE to set
	 */
	public void setLangMOE(List<Integer> langMOE) {
		this.langMOE = langMOE;
	}

	/**
	 * @return the application
	 */
	public List<Integer> getApplication() {
		return application;
	}

	/**
	 * @param application
	 *            the application to set
	 */
	public void setApplication(List<Integer> application) {
		this.application = application;
	}

	/**
	 * @return the appMOE
	 */
	public List<Integer> getAppMOE() {
		return appMOE;
	}

	/**
	 * @param appMOE
	 *            the appMOE to set
	 */
	public void setAppMOE(List<Integer> appMOE) {
		this.appMOE = appMOE;
	}

	/**
	 * @return the technology
	 */
	public List<Integer> getTechnology() {
		return technology;
	}

	/**
	 * @param technology
	 *            the technology to set
	 */
	public void setTechnology(List<Integer> technology) {
		this.technology = technology;
	}

	/**
	 * @return the techMOE
	 */
	public List<Integer> getTechMOE() {
		return techMOE;
	}

	/**
	 * @param techMOE
	 *            the techMOE to set
	 */
	public void setTechMOE(List<Integer> techMOE) {
		this.techMOE = techMOE;
	}

	/**
	 * @return the framework
	 */
	public List<Integer> getFramework() {
		return framework;
	}

	/**
	 * @param framework
	 *            the framework to set
	 */
	public void setFramework(List<Integer> framework) {
		this.framework = framework;
	}

	/**
	 * @return the frameMOE
	 */
	public List<Integer> getFrameMOE() {
		return frameMOE;
	}

	/**
	 * @param frameMOE
	 *            the frameMOE to set
	 */
	public void setFrameMOE(List<Integer> frameMOE) {
		this.frameMOE = frameMOE;
	}

	public void setFields(ActionRequest request) {
		if (request.getParameter("employeeName") != null) {
			setEmployeeName(request.getParameter("employeeName"));
		}

		setCompanyID(request.getParameter("companyID"));
		if (!request.getParameter("companyID").equals("All")) {
			setDepartmentID(request.getParameter("departmentID"));
		}

		setCourseCom(request.getParameter("courseCom"));
		if (!request.getParameter("courseCom").equals("All")) {
			setCourseDep(request.getParameter("courseDep"));
			if (!request.getParameter("courseDep").equals("All")) {
				setCourseID(request.getParameter("courseID"));
			}
		}

		setGrade(request.getParameter("grade"));

		setProjectCom(request.getParameter("projectCom"));
		if (!request.getParameter("projectCom").equals("All")) {
			setProjectDep(request.getParameter("projectDep"));
			if (!request.getParameter("projectDep").equals("All")) {
				setProjectID(request.getParameter("projectID"));
			}
		}

		this.language = new ArrayList<Integer>();
		this.langMOE = new ArrayList<Integer>();
		if (!request.getParameter("language").equals("All")) {
			String[] langList = request.getParameter("language").split(":");
			String[] langMOEList = request.getParameter("langMOE").split(":");
			for (int i = 0; i < langList.length; i++) {
				this.language.add(Integer.parseInt(langList[i]));
				if (!langMOEList[i].equals("")) {
					this.langMOE.add(Integer.parseInt(langMOEList[i]));
				} else {
					this.langMOE.add(0);
				}
			}
		}

		this.application = new ArrayList<Integer>();
		this.appMOE = new ArrayList<Integer>();
		if (!request.getParameter("application").equals("All")) {
			String[] appList = request.getParameter("application").split(":");
			String[] appMOEList = request.getParameter("appMOE").split(":");
			for (int i = 0; i < appList.length; i++) {
				this.application.add(Integer.parseInt(appList[i]));
				if (!appMOEList[i].equals("")) {
					this.appMOE.add(Integer.parseInt(appMOEList[i]));
				} else {
					this.appMOE.add(0);
				}
			}
		}

		this.technology = new ArrayList<Integer>();
		this.techMOE = new ArrayList<Integer>();
		if (!request.getParameter("technology").equals("All")) {
			String[] techList = request.getParameter("technology").split(":");
			String[] techMOEList = request.getParameter("techMOE").split(":");
			for (int i = 0; i < techList.length; i++) {
				this.technology.add(Integer.parseInt(techList[i]));
				if (!techMOEList[i].equals("")) {
					this.techMOE.add(Integer.parseInt(techMOEList[i]));
				} else {
					this.techMOE.add(0);
				}
			}
		}

		this.framework = new ArrayList<Integer>();
		this.frameMOE = new ArrayList<Integer>();
		if (!request.getParameter("framework").equals("All")) {
			String[] frameList = request.getParameter("framework").split(":");
			String[] frameMOEList = request.getParameter("frameMOE").split(":");
			for (int i = 0; i < frameList.length; i++) {
				this.framework.add(Integer.parseInt(frameList[i]));
				if (!frameMOEList[i].equals("")) {
					this.frameMOE.add(Integer.parseInt(frameMOEList[i]));
				} else {
					this.frameMOE.add(0);
				}
			}
		}
		// new pits.util.Logger().write("done setting search fields");
	}

	public List<String> validate() {
		// TODO Auto-generated method stub
		List<String> errList = new ArrayList<String>();
		return errList;
	}
}
